package com.howells.time.module.message.presenter;

import com.howells.time.base.http.HttpUtils;
import com.howells.time.base.http.JsonArrayCallback;
import com.howells.time.module.message.view.MessageView;

import java.util.List;
import java.util.Map;

import okhttp3.Call;

/**
 * Created by Administrator on 2016.5.11.
 */
public class MessagePresenterImp implements MessagePresenter {

    private MessageView messageView;

    public MessagePresenterImp(MessageView messageView) {
        this.messageView = messageView;
    }

    @Override
    public void refresh(Map info) {
        HttpUtils.Get("", info, new JsonArrayCallback() {
            @Override
            public void onError(Call call, Exception e,int id) {
                messageView.resultMsg("网络错误");
            }

            @Override
            public void onResponse(List<Object> response,int id) {
                messageView.addMessage(response);
            }
        });
    }
}
